<?php
	class multi_language
	{
		private $data;
		private static $instance;
		
		private function __construct()
		{
			$this->data = array();
		}
		
		public static function get_instance()
		{
			if(self::$instance == NULL)
			 	self::$instance = new self();
			return self::$instance;
		}
		
		function load_language($localize)
		{
			$path_localize = "languages/".$localize.".xml";
			if(!file_exists($path_localize))
			{
				$path_localize = "languages/en.xml";
			}
			
			$xml = simplexml_load_file($path_localize);
			foreach($xml->children() as $child)
			{
				$this->data[''.$child->attributes()->key.''] = ''.$child->attributes()->value.'';
			}
			//print_r($this->data);
		}
		
		public function get_word_by_key($key)
		{
			return @$this->data[$key];
		}
	}
?>